package com.neuedu.javase.operation;

/**
 * @author :金山老师
 * date    :  2025/10/16 14:47
 * project  : MyJavaSE
 * 描述      ： 逻辑运算
 */
public class OperationLogic {

    public static void main(String[] args) {

        int age = 50;
        char gender = '男';

        boolean success = age >=60 &&  gender=='男';
        System.out.println("age = " + age);
        System.out.println("gender = " + gender);


        System.out.println("age >=60 &&  gender=='男'  " + success);

        //逻辑与
        System.out.println("(true &&  true) = " + (true && true));      //true
        System.out.println("(true &&  false) = " + (true && false));  //false
        System.out.println("(false &&  true) = " + (false && true));  //false
        System.out.println("(false &&  false) = " + (false && false));  //false




        //day  15   1
        int day = 15;
        //逻辑或的关系  15号或者元旦1号 给钱
        boolean send = day == 15 || day == 1 ;

        System.out.println("day = " + day);
        System.out.println("send = " + send);
        System.out.println("!send = " + !send);
        System.out.println("!!send = " + !!send);
        System.out.println("!!!send = " + !!!send);
        System.out.println(" day == 15 || day == 1   : "+ send);

        //逻辑或
        System.out.println("(true ||  true) = " + (true || true));     //true
        System.out.println("(true ||  false) = " + (true || false));    //true
        System.out.println("(false ||  true) = " + (false || true));    //true
        System.out.println("(false ||  false) = " + (false || false));  //false



        // 逻辑取反
        System.out.println("!true = " + !true);  //false
        System.out.println("!false = " + !false); //true






        int  numa = 10;
        int numb = 5;

        //逻辑短路
        boolean reault  =   numa <5 && numb++>2;


        System.out.println("reault = " + reault);
        System.out.println("numa = " + numa);
        System.out.println("numb = " + numb);






        int myAge = 62;

        //字符串
        String str = myAge > 60  ? "允许退休"  : "不允许退休，再多干几年";

        System.out.println(str );







    }
}
